package com.ziyun.erp.modules.business.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ziyun.erp.modules.business.dao.GoodsPushDao;
import com.ziyun.erp.modules.business.entity.GoodsPushEntity;
import com.ziyun.erp.modules.business.service.GoodsPushService;
import com.ziyun.erp.modules.goods.service.GoodsService;
import io.renren.common.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;



@Service("goodsPushService")
public class GoodsPushServiceImpl extends ServiceImpl<GoodsPushDao, GoodsPushEntity> implements GoodsPushService {

    @Autowired
    private GoodsService goodsService;

    @Override
    public PageUtils list(Map<String, Object> params) {
        Page<GoodsPushEntity> page = new Page<>();
        page.setCurrent(Integer.valueOf(params.get("page").toString()));
        page.setSize(Integer.valueOf(params.get("limit").toString()));
        List<GoodsPushEntity> list = this.baseMapper.list(page, params);
        page.setRecords(list);
        return new PageUtils(page);
    }

    @Override
    public List<Map<String ,Object>> goodsList() {
        return goodsService.selectPushList();
    }

    @Override
    public GoodsPushEntity findOne(Long goodsId) {
        return this.baseMapper.findOne(goodsId);
    }

}
